/*     */ package com.umeng.newxp.view;
/*     */ 
/*     */ import android.content.Context;
/*     */ import android.graphics.Color;
/*     */ import android.graphics.Rect;
/*     */ import android.view.Display;
/*     */ import android.view.View;
/*     */ import android.view.View.OnClickListener;
/*     */ import android.view.ViewGroup;
/*     */ import android.view.WindowManager;
/*     */ import android.view.animation.AccelerateInterpolator;
/*     */ import android.view.animation.Animation;
/*     */ import android.view.animation.Animation.AnimationListener;
/*     */ import android.view.animation.AnimationUtils;
/*     */ import android.widget.BaseAdapter;
/*     */ import android.widget.GridView;
/*     */ import android.widget.ImageView;
/*     */ import android.widget.LinearLayout;
/*     */ import android.widget.RelativeLayout;
/*     */ import android.widget.RelativeLayout.LayoutParams;
/*     */ import android.widget.TextView;
/*     */ import android.widget.ViewSwitcher;
/*     */ import com.umeng.common.net.q;
/*     */ import com.umeng.common.util.j;
/*     */ import com.umeng.newxp.Promoter;
/*     */ import com.umeng.newxp.a.c;
/*     */ import com.umeng.newxp.a.d;
/*     */ import com.umeng.newxp.common.f;
/*     */ import com.umeng.newxp.controller.ExchangeDataService;
/*     */ import com.umeng.newxp.controller.a.a;
/*     */ import com.umeng.newxp.controller.b;
/*     */ import com.umeng.newxp.controller.f.a;
/*     */ import com.umeng.newxp.net.XpReportClient;
/*     */ import com.umeng.newxp.net.e;
/*     */ import com.umeng.newxp.net.e.a;
/*     */ import java.util.Collection;
/*     */ import java.util.HashMap;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ import java.util.Random;
/*     */ 
/*     */ public class aF
/*     */   implements f.a
/*     */ {
/*     */   private static final int c = 3;
/*  55 */   private static boolean d = false;
/*     */   private Context e;
/*     */   private ViewGroup f;
/*     */   int a;
/*     */   private ExchangeDataService g;
/*     */   private com.umeng.newxp.controller.a h;
/*     */   private List<Promoter> i;
/*     */   View b;
/*     */   private ViewSwitcher j;
/*  69 */   private static int k = 1000;
/*     */ 
/*  71 */   private int l = 0;
/*     */   private GridView m;
/*     */   private GridView n;
/*     */   private Map<Integer, a> o;
/*     */   private Animation p;
/*     */   private View.OnClickListener q;
/*     */   private b r;
/*     */   private GridView s;
/*     */ 
/*     */   public aF(Context paramContext, ViewGroup paramViewGroup, int paramInt, ExchangeDataService paramExchangeDataService)
/*     */   {
/*  83 */     this.e = paramContext;
/*  84 */     this.f = paramViewGroup;
/*  85 */     this.a = paramInt;
/*     */ 
/*  87 */     if (d) {
/*  88 */       d();
/*  89 */       this.p = AnimationUtils.loadAnimation(this.e, com.umeng.newxp.a.a.o(this.e));
/*  90 */       this.p.setDuration(2000L);
/*     */     }
/*     */ 
/*  93 */     this.g = paramExchangeDataService;
/*     */ 
/*  95 */     aG localaG = new aG(this);
/*     */ 
/* 116 */     this.g.requestDataAsyn(this.e, localaG);
/*     */   }
/*     */ 
/*     */   protected void b() {
/* 120 */     this.b = View.inflate(this.e, d.z(this.e), 
/* 121 */       null);
/*     */ 
/* 123 */     this.j = ((ViewSwitcher)this.b.findViewById(
/* 124 */       c.L(this.e)));
/* 125 */     this.j.setDisplayedChild(0);
/*     */ 
/* 127 */     this.m = 
/* 128 */       ((GridView)this.j.findViewById(
/* 128 */       c.K(this.e)).findViewById(c.x(this.e)));
/* 129 */     this.n = 
/* 130 */       ((GridView)this.j.findViewById(
/* 130 */       c.J(this.e)).findViewById(c.x(this.e)));
/*     */ 
/* 132 */     aH localaH = new aH(this);
/*     */ 
/* 143 */     this.m.setOnItemClickListener(localaH);
/* 144 */     this.n.setOnItemClickListener(localaH);
/*     */ 
/* 146 */     a(c.K(this.e));
/* 147 */     a(c.J(this.e));
/*     */ 
/* 152 */     if (d)
/*     */     {
/* 154 */       a locala = null;
/*     */ 
/* 158 */       locala = e();
/*     */ 
/* 160 */       this.j.setInAnimation(locala.a);
/* 161 */       this.j.setOutAnimation(locala.b);
/*     */     }
/*     */ 
/* 167 */     new j(this.e);
/* 168 */     int i1 = j.a(55.0F);
/*     */ 
/* 171 */     RelativeLayout localRelativeLayout = new RelativeLayout(this.e);
/* 172 */     localRelativeLayout.setLayoutParams(new RelativeLayout.LayoutParams(-1, 
/* 173 */       -2));
/* 174 */     localRelativeLayout.setBackgroundColor(Color.alpha(0));
/* 175 */     this.f.addView(localRelativeLayout);
/*     */ 
/* 178 */     RelativeLayout.LayoutParams localLayoutParams = new RelativeLayout.LayoutParams(-1, i1);
/*     */ 
/* 180 */     localRelativeLayout.addView(this.b, localLayoutParams);
/*     */   }
/*     */ 
/*     */   private void a(int paramInt)
/*     */   {
/* 188 */     this.s = null;
/* 189 */     List localList = null;
/* 190 */     int i1 = -1;
/* 191 */     if (paramInt == c.K(this.e)) {
/* 192 */       localList = this.h.a(3);
/* 193 */       this.s = this.m;
/* 194 */       this.s.setNumColumns(3);
/* 195 */       i1 = 0;
/*     */     } else {
/* 197 */       localList = this.h.a(3);
/* 198 */       this.s = this.n;
/* 199 */       i1 = 1;
/*     */     }
/*     */ 
/* 202 */     if ((localList == null) || (localList.size() == 0)) return;
/* 203 */     for (a.a locala : localList) {
/* 204 */       e locale = new e.a(this.e)
/* 205 */         .a(0).b(0)
/* 206 */         .d(this.g.getTimeConsuming())
/* 207 */         .d(1).c(this.a).a(new Promoter[] { locala.a })
/* 208 */         .b(com.umeng.newxp.common.g.a(this.e, this.g)).a(this.g.slot_id)
/* 209 */         .c(this.g.sessionId).a();
/* 210 */       new XpReportClient(this.e).sendAsync(locale, null);
/*     */     }
/*     */ 
/* 213 */     this.r = ((b)this.s.getAdapter());
/* 214 */     if (this.r == null)
/*     */     {
/* 216 */       this.r = new b(this.e, localList, i1);
/* 217 */       this.s.setAdapter(this.r);
/*     */     } else {
/* 219 */       this.r.a = localList;
/* 220 */       this.r.notifyDataSetChanged();
/*     */     }
/*     */   }
/*     */ 
/*     */   private void a(a.a parama, View paramView)
/*     */   {
/* 226 */     if (this.q != null) {
/* 227 */       this.q.onClick(paramView);
/*     */     }
/* 229 */     if (parama == null) return;
/* 230 */     b.a(parama, this.e, this.g, this.a, false, 0);
/*     */   }
/*     */ 
/*     */   private void d() {
/* 234 */     this.o = new HashMap();
/*     */ 
/* 237 */     this.o
/* 238 */       .put(Integer.valueOf(3), 
/* 239 */       new a(AnimationUtils.loadAnimation(this.e, 
/* 240 */       com.umeng.newxp.a.a.e(this.e)), 
/* 241 */       AnimationUtils.loadAnimation(this.e, 
/* 242 */       com.umeng.newxp.a.a.j(this.e))));
/*     */ 
/* 245 */     this.o.put(
/* 246 */       Integer.valueOf(4), 
/* 247 */       new a(AnimationUtils.loadAnimation(this.e, 
/* 248 */       com.umeng.newxp.a.a.f(this.e)), 
/* 249 */       AnimationUtils.loadAnimation(this.e, 
/* 250 */       com.umeng.newxp.a.a.i(this.e))));
/*     */ 
/* 253 */     this.o.put(
/* 254 */       Integer.valueOf(1), 
/* 255 */       new a(AnimationUtils.loadAnimation(this.e, 
/* 256 */       com.umeng.newxp.a.a.g(this.e)), 
/* 257 */       AnimationUtils.loadAnimation(this.e, 
/* 258 */       com.umeng.newxp.a.a.l(this.e))));
/*     */ 
/* 261 */     this.o
/* 262 */       .put(Integer.valueOf(2), 
/* 263 */       new a(AnimationUtils.loadAnimation(this.e, 
/* 264 */       com.umeng.newxp.a.a.h(this.e)), 
/* 265 */       AnimationUtils.loadAnimation(this.e, 
/* 266 */       com.umeng.newxp.a.a.k(this.e))));
/*     */ 
/* 269 */     this.o.put(
/* 270 */       Integer.valueOf(6), 
/* 271 */       new a(AnimationUtils.loadAnimation(this.e, 
/* 272 */       com.umeng.newxp.a.a.m(this.e)), AnimationUtils.loadAnimation(
/* 273 */       this.e, com.umeng.newxp.a.a.n(this.e))));
/*     */ 
/* 276 */     WindowManager localWindowManager = (WindowManager)this.e.getSystemService("window");
/* 277 */     Display localDisplay = localWindowManager.getDefaultDisplay();
/* 278 */     new j(this.e);
/* 279 */     int i1 = j.a(55.0F);
/*     */ 
/* 281 */     f localf1 = new f(-90.0F, 0.0F, localDisplay.getWidth() / 2, i1 / 2, true, true);
/* 282 */     localf1.setInterpolator(new AccelerateInterpolator());
/*     */ 
/* 284 */     f localf2 = new f(0.0F, 90.0F, localDisplay.getWidth() / 2, i1 / 2, false, true);
/* 285 */     localf2.setInterpolator(new AccelerateInterpolator());
/* 286 */     this.o.put(Integer.valueOf(7), new a(localf1, localf2, 
/* 287 */       k));
/*     */ 
/* 290 */     f localf3 = new f(-90.0F, 0.0F, localDisplay.getWidth() / 2, i1 / 2, true, false);
/* 291 */     localf3.setInterpolator(new AccelerateInterpolator());
/*     */ 
/* 293 */     f localf4 = new f(0.0F, 90.0F, localDisplay.getWidth() / 2, i1 / 2, false, 
/* 294 */       false);
/* 295 */     localf4.setInterpolator(new AccelerateInterpolator());
/* 296 */     this.o.put(Integer.valueOf(8), new a(localf3, localf4, 
/* 297 */       k));
/*     */   }
/*     */ 
/*     */   private a e()
/*     */   {
/* 350 */     if ((this.o == null) || (this.o.size() == 0)) {
/* 351 */       return new a(AnimationUtils.loadAnimation(this.e, 
/* 352 */         com.umeng.newxp.a.a.e(this.e)), 
/* 353 */         AnimationUtils.loadAnimation(this.e, 
/* 354 */         com.umeng.newxp.a.a.j(this.e)));
/*     */     }
/*     */ 
/* 357 */     Collection localCollection = this.o.values();
/* 358 */     int i1 = this.o.size();
/* 359 */     a[] arrayOfa = 
/* 360 */       (a[])localCollection
/* 360 */       .toArray(new a[0]);
/* 361 */     Random localRandom = new Random();
/* 362 */     return arrayOfa[localRandom.nextInt(i1)];
/*     */   }
/*     */ 
/*     */   public void a()
/*     */   {
/* 367 */     if ((this.b != null) && (this.b.getLocalVisibleRect(new Rect())) && 
/* 368 */       (this.b.getWindowVisibility() == 0) && (!aw.a())) {
/* 369 */       int i1 = this.l++ % 2 == 0 ? 1 : 0;
/* 370 */       if (d) {
/* 371 */         int i2 = 0;
/*     */ 
/* 377 */         a locala = null;
/* 378 */         if ((i2 > 0) && (this.o.containsKey(Integer.valueOf(i2)))) locala = (a)this.o.get(Integer.valueOf(i2));
/*     */         else {
/* 380 */           locala = e();
/*     */         }
/* 382 */         this.j.setInAnimation(locala.a);
/* 383 */         this.j.setOutAnimation(locala.b);
/*     */       }
/*     */ 
/* 386 */       this.j.setDisplayedChild(i1);
/*     */ 
/* 388 */       if (!d) {
/* 389 */         switch (i1) {
/*     */         case 0:
/* 391 */           a(c.J(this.e));
/* 392 */           break;
/*     */         case 1:
/* 394 */           a(c.K(this.e));
/* 395 */           break;
/*     */         }
/*     */ 
/*     */       }
/*     */ 
/*     */     }
/*     */ 
/* 402 */     new com.umeng.newxp.controller.g(this).start();
/*     */   }
/*     */ 
/*     */   public void a(View.OnClickListener paramOnClickListener)
/*     */   {
/* 413 */     this.q = paramOnClickListener;
/*     */   }
/*     */ 
/*     */   class a
/*     */     implements Animation.AnimationListener
/*     */   {
/*     */     Animation a;
/*     */     Animation b;
/*     */ 
/*     */     public a(Animation paramAnimation1, Animation arg3)
/*     */     {
/* 306 */       this.a = paramAnimation1;
/*     */       Object localObject;
/* 307 */       this.b = localObject;
/*     */ 
/* 309 */       localObject.setDuration(aF.c());
/* 310 */       paramAnimation1.setDuration(aF.c());
/*     */ 
/* 312 */       paramAnimation1.setAnimationListener(this);
/*     */     }
/*     */ 
/*     */     public a(Animation paramAnimation1, Animation paramLong, long arg4) {
/* 316 */       this.a = paramAnimation1;
/* 317 */       this.b = paramLong;
/*     */       Object localObject;
/* 319 */       paramLong.setDuration(localObject);
/* 320 */       paramAnimation1.setDuration(localObject);
/*     */ 
/* 322 */       paramAnimation1.setAnimationListener(this);
/*     */     }
/*     */ 
/*     */     public void onAnimationStart(Animation paramAnimation)
/*     */     {
/*     */     }
/*     */ 
/*     */     public void onAnimationRepeat(Animation paramAnimation)
/*     */     {
/*     */     }
/*     */ 
/*     */     public void onAnimationEnd(Animation paramAnimation)
/*     */     {
/* 335 */       int i = aF.a(aF.this).getDisplayedChild();
/* 336 */       switch (i) {
/*     */       case 0:
/* 338 */         aF.a(aF.this, c.J(aF.b(aF.this)));
/* 339 */         break;
/*     */       case 1:
/* 341 */         aF.a(aF.this, c.K(aF.b(aF.this)));
/* 342 */         break;
/*     */       }
/*     */     }
/*     */   }
/*     */ 
/*     */   public class b extends BaseAdapter
/*     */   {
/*     */     private Context d;
/*     */     public List<a.a> a;
/* 419 */     public int b = -1;
/*     */ 
/*     */     public b(List<a.a> paramInt, int arg3) {
/* 422 */       this.d = paramInt;
/*     */       Object localObject;
/* 423 */       this.a = localObject;
/*     */       int i;
/* 424 */       this.b = i;
/*     */     }
/*     */ 
/*     */     public int getCount()
/*     */     {
/* 429 */       return this.a.size();
/*     */     }
/*     */ 
/*     */     public Object getItem(int paramInt)
/*     */     {
/* 434 */       return this.a.get(paramInt);
/*     */     }
/*     */ 
/*     */     public long getItemId(int paramInt)
/*     */     {
/* 439 */       return ((a.a)this.a.get(paramInt)).b;
/*     */     }
/*     */ 
/*     */     public View getView(int paramInt, View paramView, ViewGroup paramViewGroup)
/*     */     {
/* 444 */       ViewGroup localViewGroup = (ViewGroup)LinearLayout.inflate(this.d, 
/* 445 */         d.A(this.d), null);
/*     */ 
/* 447 */       ImageView localImageView = (ImageView)localViewGroup.findViewById(
/* 448 */         c.b(this.d));
/*     */ 
/* 450 */       TextView localTextView = (TextView)localViewGroup.findViewById(c.c(this.d));
/* 451 */       localTextView.setSelected(true);
/*     */ 
/* 453 */       a.a locala = (a.a)this.a.get(paramInt);
/* 454 */       q.a(this.d, localImageView, locala.a.icon, false, null, aF.c(aF.this));
/* 455 */       localTextView.setText(locala.a.title);
/*     */ 
/* 457 */       return localViewGroup;
/*     */     }
/*     */   }
/*     */ }

/* Location:           C:\Users\Administrator\Desktop\umeng_sdk.jar
 * Qualified Name:     com.umeng.newxp.view.aF
 * JD-Core Version:    0.6.2
 */